package com.bwie.user.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bwie.user.entity.ButiveEntity;
import com.bwie.user.service.ButiveService;
import com.bwie.common.utils.PageUtils;
import com.bwie.common.utils.R;



/**
 * 
 *
 * @author ÕÔË«Ò¶
 * @email 1535715783@qq.com
 * @date 2022-01-16 20:46:55
 */
@RestController
@RequestMapping("user/butive")
public class ButiveController {
    @Autowired
    private ButiveService butiveService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = butiveService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{bid}")
    public R info(@PathVariable("bid") Integer bid){
		ButiveEntity butive = butiveService.getById(bid);

        return R.ok().put("butive", butive);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody ButiveEntity butive){
		butiveService.save(butive);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody ButiveEntity butive){
		butiveService.updateById(butive);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] bids){
		butiveService.removeByIds(Arrays.asList(bids));

        return R.ok();
    }

}
